package aufgabe_2_test.try01;

import java.util.ArrayList;

import javax.swing.table.AbstractTableModel;

public class WorkersTableModel extends AbstractTableModel{
	ArrayList<WorkerObject> workerList;
	
	public WorkersTableModel(ArrayList<WorkerObject> workerList) {
		this.workerList = workerList;
	}

	@Override
	public int getColumnCount() {
		return 2;
	}

	@Override
	public int getRowCount() {
		return workerList.size();
	}

	@Override
	public Object getValueAt(int arg0, int arg1) {
		switch(arg1){
		case 0: return workerList.get(arg0).identifier;
		case 1: return workerList.get(arg0).port;
		default: return "undefiniert";
		}
	}
	
	@Override
	public String getColumnName(int column) {

		
		switch (column) {
		case 0: return "Hostname";
		case 1: return "Port";
		default: return "undefinierte Spalte";
		}

	}
	

}
